package com.aaa.ssm.controller;

import com.aaa.ssm.entity.Order;
import com.aaa.ssm.service.OrderService;
import com.aaa.ssm.service.RegistrationService;
import com.aaa.ssm.util.Result;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @ fileName:OrderController
 * @ description:
 * @ author:zhz
 * @ createTime:2023/10/16 9:17
 * @ version:1.0.0
 */
@RestController
@RequestMapping("order")
public class OrderController extends BaseController {

    @Resource
    private OrderService orderService;

    /**
     * 生成支付二维码
     * @param order
     * @return
     */
    @PostMapping("getNativeCodeUrl")
    public Result getNativeCodeUrl(@RequestBody Order order){
        return success(orderService.getNativeByOrder(order));
    }


    /**
     * 获取支付状态
     *    请求=/order/getPayStatus/order123
     *    占位变量 {orderNo}  orderNo = order123
     * @param orderNum
     * @return
     */
    @GetMapping("getPayStatus/{orderNo}")   //PathVariable 路径变量注解
    public Result getPayStatus1(@PathVariable("orderNo") String orderNum){
        return success(orderService.getPayStatus(orderNum));
    }

}
